package cn.com.ibm.service;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;

import org.apache.wink.common.internal.MultivaluedMapImpl;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 
 * @author weizhentianxia
 * restful api entry :resource
 */
@Path("/")
public class RestResource {

	@Path("/metrics_search")
	@GET
	public Object metric_search(@PathParam("metric") String metric,
			@PathParam("from")String from,@PathParam("until") String until,
			@PathParam("format") String format) throws IOException, JSONException{
		
		Map <String , String> map = new HashMap<String, String>();
		map.put("metric", metric);
		map.put("from", from);
		map.put("until", until);
		map.put("format", format);
		RestClientResource.fetchRequest(map);
		
		return RestClientResource.fetchRequest(map).toString();
	}
	
	@GET
	public String greet(){
		return "hello";
	}
}
